package mobilesearch.service;

import mobilesearch.thread.ContactsSearchThread;
import mobilesearch.thread.SmsSearchThread;
import mobilesearch.ui.BroadcastCommand;
import android.content.ContentResolver;
import android.content.Context;
import android.util.Log;

public class MobileSearchThreadFactory {

	private static final String TAG = "MobileSearchThreadFactory";
	public MobileSearchThreadFactory() {
	}
	
	public static Thread GetSearchThread(String command, Context context, ContentResolver resolver){
		Thread thread = null;
		if(command.compareTo(BroadcastCommand.SEARCH_CONTACTS) == 0){
			Log.i(TAG, "command.compareTo(BroadcastCommand.SEARCH_CONTACTS) == 0");
			thread = new ContactsSearchThread(context,resolver);
		}
		if(command.compareTo(BroadcastCommand.SEARCH_SMS) == 0){
			Log.i(TAG, "command.compareTo(BroadcastCommand.SEARCH_SMS) == 0");
			thread = new SmsSearchThread(context, resolver);
		}	
		
		return thread;
	}
}
